Component({
  properties: {
    show: {
      type: Boolean,
      value: false,
    },
    title: {
      type: String,
      value: "",
    },
    zIndex: {
      type: Number,
      value: 100,
    },
    showClose: {
      type: Boolean,
      value: true,
    },
    showFooter: {
      type: Boolean,
      value: true,
    },
    showCancel: {
      type: Boolean,
      value: true,
    },
    cancelText: {
      type: String,
      value: "取消",
    },
    confirmText: {
      type: String,
      value: "确定",
    },
    closeOnClickOverlay: {
      type: Boolean,
      value: true,
    },
  },

  methods: {
    preventBubble() {
      // 阻止冒泡
    },

    onClickOverlay() {
      if (this.data.closeOnClickOverlay) {
        this.onClose();
      }
    },

    onClose() {
      this.triggerEvent("close");
    },

    onCancel() {
      this.triggerEvent("cancel");
    },

    onConfirm() {
      this.triggerEvent("confirm");
    },
  },
});
